import get from '@dfeidao/atom-web/local/get';
import remove from '@dfeidao/atom-web/local/remove';
import fire from '@dfeidao/atom-web/msg/fire';
import { IFeidaoAiBrowserComponent } from '@dfeidao/web/interfaces';

// import error from '@feidao/web/atom/browser/msgbox/error';
// import msg_fire from '@dfeidao/atom-web/msg/fire';

import error from '@dfeidao/atom-web/msgbox/error';
// import set_nodes_cls from '@dfeidao/atom-web/ui/set-nodes-cls';

export default async function a005(fd: IFeidaoAiBrowserComponent, args: { currentTarget: HTMLElement }) {
	//  确定
	const com_id: string = get(fd, 'comp_id');
	const event_no: string = get(fd, 'event_no');
	const package_no = get(fd, 'package_no');
	const package_name = get(fd, 'package_name');
	const client_type = get(fd, 'client_type');
	// const package_path = get(fd, 'package_path');
	if (!package_no) {
		error('请选择一个页面');
		return;
		// await error('请选择产品名称');
	} else {
		fire(com_id, event_no, { package_no, package_name, client_type });
		fd.data.node.classList.add('display-n');

		const nodes = fd.data.node.querySelectorAll('[data-alert_list]');
		nodes.forEach((i) => {
			i.classList.remove('bg-c');
		});
		args.currentTarget.classList.add('bg-c');
		remove(fd, 'package_no');
		remove(fd, 'package_name');
		remove(fd, 'client_type');
	}
}
